//package com.hansming.bss.modules.sfc.web.front;
//
//import java.io.IOException;
//import java.io.PrintWriter;
//import java.util.List;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//
//import org.activiti.engine.impl.util.json.JSONArray;
//import org.activiti.engine.impl.util.json.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.ui.Model;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import com.hansming.bss.common.web.BaseController;
//import com.hansming.bss.modules.sfc.entity.Contacts;
//import com.hansming.bss.modules.sfc.entity.Customer;
//import com.hansming.bss.modules.sfc.entity.CustomerMessage;
//import com.hansming.bss.modules.sfc.entity.CustomerScoreLog;
//import com.hansming.bss.modules.sfc.entity.Order;
//import com.hansming.bss.modules.sfc.service.ContactsService;
//import com.hansming.bss.modules.sfc.service.CustomerMessageService;
//import com.hansming.bss.modules.sfc.service.CustomerScoreLogService;
//import com.hansming.bss.modules.sfc.service.CustomerService;
//import com.hansming.bss.modules.sfc.service.OrderService;
//import com.hansming.bss.modules.sfc.util.PageBean;
//
///**
// * 前端页面个人中心相关 Controller
// * @author Hansming
// * @version 2017-10-11
// */
//@Controller
//@RequestMapping(value = "${frontAdminPath}/center")
//public class FrontCustomerCenterController extends BaseController {
//	
//	@Autowired
//	private CustomerService customerService;
//	
//	@Autowired
//	private OrderService orderService;
//	
//	@Autowired
//	private ContactsService contactsService;
//	
//	@Autowired
//	private CustomerScoreLogService customerScoreLogService;
//	
//	@Autowired
//	private CustomerMessageService customerMessageService;
//	
//	
//	//个人中心信息传输 
//	@RequestMapping( value = "")
//	public String getCustomerCenter(HttpServletRequest request, HttpServletResponse response,Order order,PageBean page,Model model) throws IOException{
//		HttpSession session = request.getSession();
//		Customer cus =  (Customer) session.getAttribute("cus");
//		if(cus ==null){
//			return "";					//当未登陆的时候直接跳转登陆界面		
//		}
//		List<Contacts> contacts =contactsService.getContactsByuserId(cus.getId()); 
//		
//		int num = 3;							//个人中心显示的第一页的信息数量
//		List<Order> orders = orderService.findOrderListByUserid(cus.getId(), num);
//		
//		
//		model.addAttribute("contacts", contacts);
//		model.addAttribute("orders", orders);
//		return "";
//	}
//	
//	
//	
//	
//	//用户个人更新订单
//	@RequestMapping(value ="/update")
//	public String UpdateOrderByCustomerid(String cusid,Order order){
//		
//		return "";
//	}
//	
//	
//	//用户得到积分日志
//	@RequestMapping(value = "/getscorelog")
//	public String getScoreLog(HttpServletRequest request, HttpServletResponse response) throws IOException{
//		HttpSession session = request.getSession();
//		Customer cus =  (Customer) session.getAttribute("cus");
//		List<CustomerScoreLog> scoreLogges = customerScoreLogService.getCustomerScoreLogsByCusid(cus.getId());
//		
//		
//		
//		
//		return "";
//	}
//	
//	//个人中心主页不同情况的Ajax 不同状态的变化传输数据
//	@RequestMapping(value = "/orderStatsAjax")
//	public void customerIndexOrderStatsAjax(HttpServletRequest request, HttpServletResponse response,String state) throws IOException{
//		response.setCharacterEncoding("UTF-8");
//        response.setHeader("Cache-Control", "no-cache");
//        PrintWriter out = response.getWriter();
//        JSONObject jsonObject = new JSONObject();
//		String resCode = "1";								//返回前台的消息状态
//		String message = "";								//返回前台的消息
//		JSONArray datas = new JSONArray();		//返回到前台的具体的价格日期信息json
//		HttpSession session = request.getSession();
//		Customer cus =  (Customer) session.getAttribute("cus");
//		List<Order> orders = orderService.findOrderListBycusidAndOrderStats(cus.getId(), state);
//		
//		
//		jsonObject.put("resCode", resCode);
//		jsonObject.put("message", message);
//		jsonObject.put("data", datas);
//		out.print(jsonObject.toString());
//		out.flush();
//		out.close();
//	}
//	
//	
//	//个人中心消息提醒，中消息传播
//	@RequestMapping(value = "/getMsg")
//	public String getCustomerMessage(HttpServletRequest request, HttpServletResponse response,Model model){
//		HttpSession session = request.getSession();
//		Customer cus =  (Customer) session.getAttribute("cus");
//
//		List<CustomerMessage> sysmessages = customerMessageService.getCusMsgByCus(cus.getId(),"system");
//		List<CustomerMessage> ordmessages = customerMessageService.getCusMsgByCus(cus.getId(), "order");
//		model.addAttribute("sysMessages", sysmessages);
//		model.addAttribute("ordMessages", ordmessages);
//		return "";
//	}
//}
